package cool.taomu.toolkit.service.kademlia.provider

import com.google.inject.AbstractModule
import com.google.inject.TypeLiteral
import com.google.inject.name.Names
import cool.taomu.toolkit.service.kademlia.entity.KPeerNode
import java.util.List
import java.util.concurrent.ArrayBlockingQueue

class KBucketsModule extends AbstractModule {
    override configure() {
        bind(new TypeLiteral<List<ArrayBlockingQueue<KPeerNode>>>(){})
        .annotatedWith(Names.named(
            "taomu.toolkit.kademlia.kbuckets"
        ))
        .toProvider(KBucketsProvider).asEagerSingleton
        bind(KPeerNode).annotatedWith(Names.named(
            "taomu.toolkit.kademlia.local.node"
        )).toProvider(KPeerNodeProvider).asEagerSingleton
        //bind(KRoutingTable).toProvider(RoutingTableProvider).asEagerSingleton
    }
}